package design_mode.工厂模式;

import design_mode.工厂模式.运算方法.*;

public class OperationFactory {
    // 封装创建对象过程
    public static AbstractOperation createOperation(String operate){
        AbstractOperation oper = null;
        switch (operate) {
            case "+":
                oper = new Add();
                break;
            case "-":
                oper = new Subtract();
                break;
            case "*":
                oper = new Multiplication();
                break;
            case "/":
                oper = new DivisionMethod();
                break;
        }
        return oper;
    }
}
